<?php


namespace app\job;
use think\queue\Job;

class Task
{

    public function fire(Job $job,$data){
        $rt=$this->doJob($data);
        if($rt){
            $job->delete();
            return true;
        }
        //最多尝试三次
        if($job->attempts()==3){
            $job->delete();
            return false;
        }
        $job->release(10);//最多十秒结束
    }
    public function doJob($data){
        echo date('Y-m-d H:i:s')."\n";
        return false;
    }
}